package com.example.hdx.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.example.hdx.entity.Cart;
import com.example.hdx.util.FwResult;

import java.util.List;

// CartService.java
public interface CartService extends IService<Cart> {
    // 添加商品到购物车
    FwResult<Boolean> addToCart(Long userId, Long productId, Integer quantity);

    // 更新购物车商品数量
    FwResult<Boolean> updateQuantity(Long userId, Long productId, Integer quantity);

    // 删除购物车商品
    FwResult<Boolean> removeFromCart(Long userId, Long productId);

    // 获取用户购物车列表（包含商品信息）
    FwResult<List<Cart>> getUserCart(Long userId);

    // 更新商品选中状态
    FwResult<Boolean> updateSelected(Long userId, Long productId, Boolean selected);

    // 全选/取消全选
    FwResult<Boolean> selectAll(Long userId, Boolean selected);

    List<Cart> getCartWithProductDetails(Long userId);
}

